//
//  MyTitleView.swift
//  weibo08
//
//  Created by 陈杰明 on 16/3/3.
//  Copyright © 2016年 JM. All rights reserved.
//

import UIKit

class MyTitleView: UIButton {

//    override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
//        
//    }
//    override func titleRectForContentRect(contentRect: CGRect) -> CGRect {
//        
//    }
    
    init(name: String) {
    super.init(frame: CGRectZero)
        self.setTitle(name, forState: UIControlState.Normal)
        self.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        self.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
//        self.setImage(UIImage(named: "navigationbar_arrow_up"), forState: UIControlState.Highlighted)
        self.sizeToFit()
        
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        titleLabel?.frame.origin.x = 0
        
        imageView?.frame.origin.x = titleLabel!.frame.width + 3
        
        
    }
}
